<template>
	<view class="contents" :style="'height:'+screenHeight+'px;'">
		<!-- <view class="bodys">
			<view class="none" v-if="show">
				<view class="coent">
					<u-empty text="您已提交过满意度评价" mode="list" icon-size="200">
					</u-empty>
				</view>
			</view>
			<view class="conent" v-else>
				<view class="header">
					<span>满意度调查问卷</span>
				</view>
				<view class="" style="padding: 10rpx;">
					<span>&emsp;为了给您提供更好的服务，希望您能抽出几分钟时间，将您的感受和建议告诉我们，我们非常重视每位用户的宝贵意见，期待您的参与！</span>
				</view>
				<view class="neiorng">
					<view class="datalist" v-for="(item,index) in datalist" :key="index">
						<view class="list">
							<span style="color: red;">*&nbsp;</span>
							<span style="font-weight: bold;">{{item.ProTempCode}}.&nbsp;</span>
							<span>{{item.ProTemContent}}</span>
						</view>
						<view class="listb">
							<u-radio-group v-model="wjtx[index].value">
								<u-radio v-for="(itema, indexa) in wjtx[index].lists" @change="radioGroupChange" :key="indexa" :name="itema.name">
									{{itema.name}}
								</u-radio>
							</u-radio-group>
						</view>
					</view>
					<view class="jianyi">
						<view style="margin-bottom: 10rpx;">欢迎您向我们的服务还有其他意见和建议</view>
						<u-input v-model="jianyival" border type="textarea"  />
					</view>
					<view style="width: 100%;display: flex;justify-content: center;padding:40rpx;">
						<view class="submit" >
							<u-button type="primary" @click="submit">提交</u-button>
						</view>
					</view>
				</view>
				
			</view>
			
		</view>
		 -->
		 <web-view src="https://bestcem.com/s/646da896d3544400099da6de?source=11&scenes=11&xm_custom=1&hospital_name=%E5%BE%90%E5%B7%9E%E5%A4%8D%E5%85%B4%E7%9C%BC%E7%A7%91%E5%8C%BB%E9%99%A2&hospital_code=XZ&code=XZ&org_code=huaxiaeye&deliver_id=64e2cd1364f1850038baad26&xm_project_id=646da896d3544400099da6de&signature=f41930a98c4f74e1d8798860cc7d5fae"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show:true,
				jianyival:'',
				screenHeight: getApp().globalData.screenHeight-44,
				datalist: '',
				wjtx: [],
				text:''
			}
		},
		onLoad() {
			// this.list()
		},
		methods: {
			ssss(index){
				console.log("满意度问题", index)
				if(this.text!=''){
					this.wjtx[index].value=this.text
				}
				console.log("wjtx",this.wjtx)
			},
			submit(){
				uni.showLoading({
					title: '请稍后',
					mask: true
				});
				let sum=0
				let item=this.wjtx
				for(let i=0;i<item.length;i++){
					if(item[i].value=='非常满意'){
						sum+=10
					}else if(item[i].value=='满意'){
						sum+=8
					}else if(item[i].value=='一般'){
						sum+=6
					}else{
						sum+=0
					}
				}
				console.log("总分",sum)
				// return
				this.$request("ProblemTem", "Submit",{
					Content:this.jianyival,
					GeneralComments:sum
				}).then(res => {
					console.log("提交满意度问题", res)
					if (res.code == 1) {
						this.show=true
						uni.hideLoading();
				
					} else {
						uni.hideLoading();
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						});
					}
				}).catch(err => {
					uni.hideLoading();
					console.log("err", err)
					uni.showToast({
						title: err,
						icon: 'none',
						duration: 1000
					});
				});
			},
			radioChange(e) {
				console.log(e);
			},
			// 选中任一radio时，由radio-group触发
			radioGroupChange(e) {
				console.log(e);
				this.text=e
				console.log("wsat",this.wjtx)
			},
			list() {
				uni.showLoading({
					title: '请稍后',
					mask: true
				});
				this.$request("ProblemTem", "list").then(res => {
					console.log("满意度问题", res)
					if (res.code == 1) {
						this.datalist = res.data
						this.wjtx=[]
						let objet = {
							lists: [{
									name: '非常满意',
									value: 10
								},
								{
									name: '满意',
									value: 8
								},
								{
									name: '一般',
									value: 6
								}, {
									name: '不满意',
									value: 0
								},
							],
							value: '非常满意'
						}
						for(let i=0;i<res.data.length;i++){
							this.wjtx[i]=JSON.parse(JSON.stringify(objet))
						}
						console.log("this.wjtx",this.wjtx)
						this.show=false
						uni.hideLoading();

					} else {
						this.show=true
						uni.hideLoading();
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						});
					}
				}).catch(err => {
					this.show=true
					uni.hideLoading();
					console.log("err", err)
					uni.showToast({
						title: err,
						icon: 'none',
						duration: 1000
					});
				});
			}
		}
	}
</script>

<style>
	@import './myddc.css';
</style>